package com.na.report.core;

import com.na.report.db.NetTraffic;

public class NetTrafficInfo {

	public static class NetTrafficDetail {
		private short type;
		private String name;
		private int count;
		private long len;
		public short getType() {
			return type;
		}
		public void setType(short type) {
			this.type = type;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public int getCount() {
			return count;
		}
		public void setCount(int count) {
			this.count = count;
		}
		public long getLen() {
			return len;
		}
		public void setLen(long len) {
			this.len = len;
		}
	}
	
	private String type;
	private NetTrafficDetail[] infos;
	
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public NetTrafficDetail[] getInfos() {
		return infos;
	}

	public void setInfos(NetTrafficDetail[] infos) {
		this.infos = infos;
	}

	public NetTraffic[] toEntities(String ip) {
		int len = infos.length;
		NetTraffic[] entities = new NetTraffic[len];
		for (int i = len - 1; i >= 0; i--) {
			NetTrafficDetail detail = infos[i];
			entities[i] = new NetTraffic(type, String.valueOf(detail.type), detail.name, detail.count, detail.len, ip);
		}
		return entities;
	}
}
